package com.jeect.gateway3.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

@Component
public class AuthZuulFilter extends ZuulFilter {
    public AuthZuulFilter() {
    }

    public String filterType() {
        return "pre";
    }

    public int filterOrder() {
        return 0;
    }

    public boolean shouldFilter() {
        return true;
    }

    public Object run() {
        RequestContext context = RequestContext.getCurrentContext();
        HttpServletRequest request = context.getRequest();
        System.out.println("sessionid =====" + request.getSession().getId());
        context.setResponseStatusCode(200);
        context.setRequest(request);
        context.setSendZuulResponse(true);
        return null;
    }
}
